/******************************************************************************
 * Copyright 2022 The Untouch Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *****************************************************************************/

#pragma once

#include <QDialog>
#include <QStandardItemModel>
#include <memory>
#include <vector>

#include "modules/calibration/lidar_imu_calibrator/include/record_data.h"

namespace Ui {
class RecordDataDialog;
}

class RecordDataDialog : public QDialog {
  Q_OBJECT
 public:
  explicit RecordDataDialog(QWidget *parent = 0);
  ~RecordDataDialog();

 protected:
  void closeEvent(QCloseEvent *event);

 private slots:
  void on_btnOdometryTopicRefresh_clicked();
  void on_btnLidarTopicRefresh_clicked();
  void on_btnCacheFolderBrowser_clicked();
  void on_btnStart_clicked();
  void on_btnExit_clicked();

 private:
  void Start();
  void Stop();
  void EnableControls(bool enable);
  bool IsInputValid();

 private:
  Ui::RecordDataDialog *ui;
  bool start_flag_;
  std::shared_ptr<QStandardItemModel> item_mode_;
  QString odometry_topic_;
  QString cache_folder_path_;
  std::vector<std::string> lidar_topics_;
  std::unique_ptr<RecordData> record_data_;
};
